// pages/my/my.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    dataArray: [{
        icon: "/assets/img/myOrder.png",
        title: "我的订单",
        intro: "",
        introColor: "#ccc",
        link: "/pages/my/myOrder/myOrder"
      },
      {
        icon: "/assets/img/yhCard.png",
        title: "我的优惠券",
        intro: "0 张",
        introColor: "#ccc",
        link: "/foods"
      },
      {
        icon: "/assets/img/jifen.png",
        title: "积分商城",
        link: "/foods"
      },
      {
        icon: "/assets/img/tuijian.png",
        title: "推荐有奖",
        intro: "每人免费送一碗面",
        introColor: "#ff0000",
        link: "/foods"
      },
      {
        icon: "/assets/img/kefu.png",
        title: "联系客服",
        link: "/pages/customerService/customerService"
      }
    ],
    phone: "15809181640",
    phoneBool: true
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {


  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function() {

  },
  //  点击去哪儿

  goWhere(e) {
    let where = e.currentTarget.dataset.where;
    console.log("where--->", where);
    wx.navigateTo({
      url: where,
      success: function(res) {},
      fail: function(res) {
        wx.showToast({
          title: '暂无',
          icon: '',
          image: '/assets/img/wrongfff.png',
          duration: 1000,
          mask: true,
          success: function(res) {},
          fail: function(res) {},
          complete: function(res) {},
        })
      },
      complete: function(res) {},
    })
  },

  // 电话 更改 点击之后
  changePhoneNumber(e) {
    let that = this;
    this.setData({
      phoneBool: !that.data.phoneBool
    })
  },
  // 失去焦点之后 
  bindblurNumber(e) {
    let that = this;
    this.setData({
      phoneBool: !that.data.phoneBool
    })
    wx.showModal({
      title: '提示',
      content: `确定上传${that.data.phone}号码？`,
      showCancel: true,
      cancelText: '取消',
      cancelColor: '',
      confirmText: '确定',
      confirmColor: '',
      success: function(res) {
        // 上传电话号码 接口
        

      },
      fail: function(res) {},
      complete: function(res) {},
    })

  }
})